home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of MacTutor - S…e Code for Volumes 1 to 5
/
The Best of MacTutor - Source Code for Volume 1-5 (Wayzata Technology)(6031)(1990).bin
/
Source Code
/
#10 (Jul 86)
/
modula source
/
PBFileManager.MOD
< prev
next >
Wrap
Text File
|
1986-04-10
|
10KB
|
364 lines
(* Tom Taylor
3707 Poinciana Dr. #137
Santa Clara, CA 95051 *)
IMPLEMENTATION MODULE PBFileManager;
(* This module implements the low level
file system described in the latest
File Manager documentation. The
procedures implemented in this
module support both MFS and HFS
calls. However, attempting to
call an HFS-only routine on a
system without HFS will bomb. *)
FROM ASMInterface IMPORT
ASM_MCode, InstallAssembly;
FROM Terminal IMPORT
WriteString;
FROM MacSystemTypes IMPORT
OsErr;
FROM SYSTEM IMPORT
ADDRESS;
VAR
modnum : INTEGER; (* Module number of
assembly routine *)
PROCEDURE PBMountVol
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A00Fh, 0);
END PBMountVol;
PROCEDURE PBGetVInfo
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A007h, 0);
END PBGetVInfo;
PROCEDURE PBHGetVInfo
(pBlk: HParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A207h, 0);
END PBHGetVInfo;
PROCEDURE PBHSetVInfo
(pBlk: HParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A260h, 11);
END PBHSetVInfo;
PROCEDURE PBGetVol
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A014h, 0);
END PBGetVol;
PROCEDURE PBHGetVol
(pBlk: HParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A214h, 0);
END PBHGetVol;
PROCEDURE PBSetVol
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A015h, 0);
END PBSetVol;
PROCEDURE PBHSetVol
(pBlk: WDPBPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A215h, 0);
END PBHSetVol;
PROCEDURE PBFlushVol
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A013h, 0);
END PBFlushVol;
PROCEDURE PBUnmountVol
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A00Eh, 0);
END PBUnmountVol;
PROCEDURE PBOffLine
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A035h, 0);
END PBOffLine;
PROCEDURE PBEject
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A017h, 0);
END PBEject;
PROCEDURE PBOpen
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A000h, 0);
END PBOpen;
PROCEDURE PBHOpen
(pBlk: HParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A20Fh, 0);
END PBHOpen;
PROCEDURE PBOpenRF
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A00Ah, 0);
END PBOpenRF;
PROCEDURE PBHOpenRF
(pBlk: HParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A20Ah, 0);
END PBHOpenRF;
PROCEDURE PBLockRange
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A260h, 16);
END PBLockRange;
PROCEDURE PBUnlockRange
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A260h, 17);
END PBUnlockRange;
PROCEDURE PBRead
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A002h, 0);
END PBRead;
PROCEDURE PBWrite
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A003h, 0);
END PBWrite;
PROCEDURE PBGetFPos
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A018h, 0);
END PBGetFPos;
PROCEDURE PBSetFPos
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A044h, 0);
END PBSetFPos;
PROCEDURE PBGetEOF
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A011h, 0);
END PBGetEOF;
PROCEDURE PBSetEOF
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A012h, 0);
END PBSetEOF;
PROCEDURE PBAllocate
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A010h, 0);
END PBAllocate;
PROCEDURE PBAllocContig
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A210h, 0);
END PBAllocContig;
PROCEDURE PBFlushFile
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A045h, 0);
END PBFlushFile;
PROCEDURE PBClose
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A001h, 0);
END PBClose;
PROCEDURE PBCreate
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A008h, 0);
END PBCreate;
PROCEDURE PBHCreate
(pBlk: HParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A208h, 0);
END PBHCreate;
PROCEDURE PBDirCreate
(pBlk: HParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A260h, 6);
END PBDirCreate;
PROCEDURE PBDelete
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A009h, 0);
END PBDelete;
PROCEDURE PBHDelete
(pBlk: HParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A209h, 0);
END PBHDelete;
PROCEDURE PBGetFInfo
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A00Ch, 0);
END PBGetFInfo;
PROCEDURE PBHGetFInfo
(pBlk: HParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A20Ch, 0);
END PBHGetFInfo;
PROCEDURE PBSetFInfo
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A00Dh, 0);
END PBSetFInfo;
PROCEDURE PBHSetFInfo
(pBlk: HParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A20Dh, 0);
END PBHSetFInfo;
PROCEDURE PBSetFLock
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A041h, 0);
END PBSetFLock;
PROCEDURE PBHSetFLock
(pBlk: HParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A241h, 0);
END PBHSetFLock;
PROCEDURE PBRstFLock
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A042h, 0);
END PBRstFLock;
PROCEDURE PBHRstFLock
(pBlk: HParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A242h, 0);
END PBHRstFLock;
PROCEDURE PBSetFVers
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A043h, 0);
END PBSetFVers;
PROCEDURE PBRename
(pBlk: ParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A00Bh, 0);
END PBRename;
PROCEDURE PBHRename
(pBlk: HParmBlkPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A20Bh, 0);
END PBHRename;
PROCEDURE PBGetCatInfo
(pBlk: CInfoPBPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A260h, 9);
END PBGetCatInfo;
PROCEDURE PBSetCatInfo
(pBlk: CInfoPBPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A260h, 10);
END PBSetCatInfo;
PROCEDURE PBCatMove
(pBlk: CInfoPBPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A260h, 5);
END PBCatMove;
PROCEDURE PBOpenWD
(pBlk: WDPBPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A260h, 1);
END PBOpenWD;
PROCEDURE PBCloseWD
(pBlk: WDPBPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A260h, 2);
END PBCloseWD;
PROCEDURE PBGetWDInfo
(pBlk: WDPBPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A260h, 7);
END PBGetWDInfo;
PROCEDURE PBGetFCBInfo
(pBlk: FCBPBPtr; async: BOOLEAN) : OsErr;
BEGIN
RETURN LowLevelPB (pBlk, async, 0A260h, 8);
END PBGetFCBInfo;
PROCEDURE LowLevelPB (pBlk: ADDRESS;
async: BOOLEAN;
trap: CARDINAL;
selector: INTEGER) : OsErr;
(* This procedure is responsible for calling
the assembly language routine that actually
calls the PB trap. *)
PROCEDURE LowLevelPB (pBlk: ADDRESS;
async: BOOLEAN;
trap: CARDINAL;
selector: INTEGER;
modnum: INTEGER) : OsErr;
CODE ASM_MCode; 0; END LowLevelPB;
BEGIN
RETURN LowLevelPB (pBlk, async, trap, selector, modnum);
END LowLevelPB;
BEGIN
(* Look for a MASM resource with ID
of 1986 in current open resource
files. It better be in our
.LOD file, put there by M2 Linker *)
modnum := InstallAssembly("",1986);
IF modnum < 1 THEN
WriteString("Cannot load PB asm code");
HALT
END;
END PBFileManager.